<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>键盘事件</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
      <div id ="root">
        <h2>欢迎来到{{name}}</h2>
        <input type="text" placeholder="按照回车提示输入" @keydown.huiche="showInfo">
      </div>
</body>
  <script>
       Vue.config.keyCodes.huiche = 13
       new Vue({
        el:'#root',
        data:{
            name:"尚硅谷"
        },
        methods:{
            showInfo(e){
                console.log(e.target.value)
            }
        }
       })
  </script>
</html>